"AutodiscoverLocalException" - "The Autodiscover service couldn't be located" while using EWS Managed API 2.2

Hi,

is your Exchange 2013 on premise ? If so, try adding  :

exchangeService.EnableScpLookup = true;

Regards,

March 11th, 2015 6:25am

Hi everybody,

I am using EWS Managed API 2.2 to get Autodiscover settings. But it is giving me 'Microsoft.Exchange.WebServices.Data.AutodiscoverLocalException'. The message is "The Autodiscover service couldn't be located." The stack trace is:

   at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetLegacyUserSettings[TSettings](String emailAddress, List`1 redirectionEmailAddresses, Int32& currentHop)
   at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetLegacyUserSettings[TSettings](String emailAddress)
   at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.InternalGetLegacyUserSettings(String emailAddress, List`1 requestedSettings)
   at Microsoft.Exchange.WebServices.Autodiscover.AutodiscoverService.GetUserSettings(String userSmtpAddress, UserSettingName[] userSettingNames)
   at Microsoft.Exchange.WebServices.Data.ExchangeService.GetAutodiscoverUrl(String emailAddress, ExchangeVersion requestedServerVersion, AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback)
   at Microsoft.Exchange.WebServices.Data.ExchangeService.AutodiscoverUrl(String emailAddress, AutodiscoverRedirectionUrlValidationCallback validateRedirectionUrlCallback)
   at Microsoft.Exchange.WebServices.Data.ExchangeService.AutodiscoverUrl(String emailAddress)
   at ConsoleApplication1.Program.Main(String[] args) in c:\Users\pse\Documents\Visual Studio 2013\Projects\ConsoleApplication1\ConsoleApplication1\Program.cs:line 92
   at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

The code that I am using is:

static void Main(string[] args)
        {
            ExchangeService exchangeService = new ExchangeService(ExchangeVersion.Exchange2013_SP1);
            exchangeService.Credentials = new NetworkCredential("mailboxName", "Password", "domainName");
            exchangeService.TraceEnabled = true;
            exchangeService.TraceFlags = TraceFlags.All;
            exchangeService.AutodiscoverUrl("mailboxName@domainName");
        }

I am using Exchange Server 2013 with Cumulative Update 7. Kindly help me.

Thanks & regards,

Talib Hussain


  • Edited by talib2608 Wednesday, March 11, 2015 7:07 AM
Free Windows Admin Tool Kit Click here and download it now
March 11th, 2015 7:05am

Hi Dsir,

I am using Exchange on premises. I am using Exchange Server 2013 with Cumulative Update 7 as stated in previous post. I have tried your suggestion, still I am getting the same exception.

March 11th, 2015 7:12am

Since you're tracing, please post your trace. Nine times out of ten this is an authentication issue. However, in your case, it might be a redirection issue, since you're not using the version of AutodiscoverUrl that takes a redirect callback.

Free Windows Admin Tool Kit Click here and download it now
March 11th, 2015 11:59am

Hi Jason,

Here the the link to the Autodiscover trace that I have uploaded in OneDrive: Autodiscover Trace - OneDrive. There are two Exchange Server 2013 with Cumulative Update 7. If we connect to any of those Exchange Servers, then also it will work - correct me if I am wrong.

March 12th, 2015 1:48am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics